﻿namespace WMS6.Web
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Web;
    using WMS6.Web.StockCountServiceRef;

    public class StockCountServiceClientProxy : BasePage
    {
        public string AdjustInventoryQtyForPc(string physicalrequestID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.AdjustInventoryQtyForPc(physicalrequestID, pubParasInfo);
            }
        }

        public string CycleCountRelease(CycleCountCriteriaInfo cycleCountCriteriaInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.CycleCountRelease(cycleCountCriteriaInfo, pubParasInfo);
            }
        }

        public string DeleteCycleCountRelease(List<string> ReleaseID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.DeleteCycleCountRelease(ReleaseID, pubParasInfo);
            }
        }

        public string DeleteCycleCountRequest(List<string> IDS)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.DeleteCycleCountRequest(IDS, pubParasInfo);
            }
        }

        public string DeleteCycleCountTag(string releaseID, List<string> TagNo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.DeleteCycleCountTag(releaseID, TagNo, pubParasInfo);
            }
        }

        public string DeletePhysicalRequest(List<string> prID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.DeletePhysicalRequest(prID, pubParasInfo);
            }
        }

        public string DeletePhysicalTag(List<string> prID, List<string> tagNo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.DeletePhysicalTag(prID, tagNo, pubParasInfo);
            }
        }

        public DataSet GetAllCycleCountRelease()
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetAllCycleCountRelease(pubParasInfo);
            }
        }

        public DataSet GetAllCycleCountRequest()
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetAllCycleCountRequest(pubParasInfo);
            }
        }

        public DataSet GetAllPhysicalRequest()
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetAllPhysicalRequest(pubParasInfo);
            }
        }

        public DataSet GetAllPhysicalTag()
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetAllPhysicalTag(pubParasInfo);
            }
        }

        public DataSet GetCycleCountReleaseByQueryEntity(CycleCountReleaseQueryEntity cycleCountReleaseEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetCycleCountReleaseByQueryEntity(cycleCountReleaseEntity, pubParasInfo);
            }
        }

        public CycleCountReleaseInfo GetCycleCountReleaseInfoByID(string releaseID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetCycleCountReleaseInfoByID(releaseID, pubParasInfo);
            }
        }

        public DataSet GetCycleCountRequestByQueryEntity(CycleCountRequestQueryEntity cycleCountRequestQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetCycleCountRequestByQueryEntity(cycleCountRequestQueryEntity, pubParasInfo);
            }
        }

        public CycleCountRequestInfo GetCycleCountRequestInfoByID(string physicalrequestID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetCycleCountRequestInfoByID(physicalrequestID, pubParasInfo);
            }
        }

        public CycleCountTagInfo GetCycleCountTagByID(string ReleaseID, string TagNo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetCycleCountTagByID(ReleaseID, TagNo, pubParasInfo);
            }
        }

        public static StockCountServiceClientProxy GetInstance()
        {
            return new StockCountServiceClientProxy();
        }

        public PhysicalRequestInfo GetPCReviewInfoByID(string physicalrequestID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetPCReviewInfoByID(physicalrequestID, pubParasInfo);
            }
        }

        public PhysicalRequestInfo GetPhysicalRequestByID(string physicalrequestID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetPhysicalRequestInfoByID(physicalrequestID, pubParasInfo);
            }
        }

        public DataSet GetPhysicalRequestDAByQueryEntity(PhysicalRequestQueryEntity physicalRequestQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetPhysicalRequestDAByQueryEntity(physicalRequestQueryEntity, pubParasInfo);
            }
        }

        public DataSet GetPhysicalTagDAByQueryEntity(PhysicalTagQueryEntity physicalTagQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetPhysicalTagDAByQueryEntity(physicalTagQueryEntity, pubParasInfo);
            }
        }

        public PhysicalTagInfo GetPhysicalTagInfoByID(string physicalrequestID, int TagNo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetPhysicalTagInfoByID(physicalrequestID, TagNo, pubParasInfo);
            }
        }

        public List<string> GetPhysicalTagNoListByID(string physicalrequestID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.GetPhysicalTagNoListByID(physicalrequestID, pubParasInfo);
            }
        }

        private PubParasInfo InitPubParasInfo()
        {
            if (base.UserInfo != null)
            {
                return new PubParasInfo { UserID = base.UserInfo.UserID, UserLanguage = base.UserInfo.Preference.Lang, CurrentWH = base.UserInfo.CurrentWH };
            }
            HttpContext.Current.Response.Redirect("../Login.aspx?from=Logout", true);
            return null;
        }

        public string InsertCycleCountRelease(CycleCountReleaseInfo cycleCountReleaseInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.InsertCycleCountRelease(cycleCountReleaseInfo, pubParasInfo);
            }
        }

        public string InsertCycleCountRequest(CycleCountRequestInfo cycleCountRequestInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.InsertCycleCountRequest(cycleCountRequestInfo, pubParasInfo);
            }
        }

        public string InsertPhysicalRequest(PhysicalRequestInfo physicalrequestInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.InsertPhysicalRequest(physicalrequestInfo, pubParasInfo);
            }
        }

        public string InvHoldForPC(string physicalrequestID, string strType)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.InvHoldForPC(physicalrequestID, strType, pubParasInfo);
            }
        }

        public string SetCycleCountCriteria(CycleCountCriteriaInfo cycleCountCriteriaInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.SetCycleCountCriteria(cycleCountCriteriaInfo, pubParasInfo);
            }
        }

        public string UpdateCycleCountRelease(CycleCountReleaseInfo cycleCountReleaseInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdateCycleCountRelease(cycleCountReleaseInfo, pubParasInfo);
            }
        }

        public string UpdateCycleCountRequest(CycleCountRequestInfo cycleCountRequestInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdateCycleCountRequest(cycleCountRequestInfo, pubParasInfo);
            }
        }

        public string UpdateCycleCountTag(List<CycleCountTagInfo> cycleCountTagInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdateCycleCountTag(cycleCountTagInfo, pubParasInfo);
            }
        }

        public string UpdatePhysicalRequest(PhysicalRequestInfo physicalrequestInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdatePhysicalRequest(physicalrequestInfo, pubParasInfo);
            }
        }

        public string UpdatePhysicalTag(PhysicalTagInfo physicalTagInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdatePhysicalTag(physicalTagInfo, pubParasInfo);
            }
        }

        public string UpdatePhysicalTagList(List<PhysicalTagInfo> physicalTagInfo, string CountType)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdatePhysicalTagList(physicalTagInfo, CountType, pubParasInfo);
            }
        }

        public string UpdateTagQtyByReleaseIDAndTagNo(CycleCountTagInfo cycleCountTagInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            using (StockCountServiceClient client = new StockCountServiceClient("WSHttpBinding_IStockCountService"))
            {
                return client.UpdateTagQtyByReleaseIDAndTagNo(cycleCountTagInfo, pubParasInfo);
            }
        }
    }
}

